package com.lagou.cl.servlet;

import com.lagou.cl.pojo.Request;
import com.lagou.cl.pojo.Response;
import com.lagou.cl.util.HttpProtocolUtil;

import java.io.IOException;

//http://localhost:8081/summer1/lagouServlet
public class LagouServlet extends AbstractHttpServlet {

	@Override
	public void doGet(Request request, Response response) {

		String data = "<h1>lagou Servlet</h1>";

		try {

			//模拟多线程
			//Thread.sleep(2000);

			response.out(HttpProtocolUtil.get_200(data.length()) + data);
		} catch (IOException e) {
			e.printStackTrace();
		}

	}

	@Override
	public void doPost(Request request, Response response) {
		String data = "<h1>lagou Servlet</h1>";

		try {
			response.out(HttpProtocolUtil.get_200(data.length()) + data);
		} catch (IOException e) {
			e.printStackTrace();
		}

	}
}
